import {action, observable} from 'mobx'
class CfStore {
  constructor() {
    this.createIdentify()
  }
  @observable loginState = false
  @observable identifyNum = ''
  @action
  alertMsg() {
    this.name='yui'
  }
  @action
  createIdentify = () => { // 产生 验证码
    console.log('createIdentify()')
    let iArr = []
    for (let i = 0; i < 4; i++) iArr.push(parseInt(Math.random() * 10))
    console.log(iArr)
    let str = iArr.join('')
    console.log('生成验证码是:',this.identifyNum)
    this.identifyNum = str
  }
  @action
  verifyIdentify = (val) => { // 验证验证码
    console.log('verifyIdentify()',val,this.identifyNum)
    let result = val===this.identifyNum?true: false
    return result
  }
}
export default CfStore
